<div style="display:flex;">
  <div style="width:20px;"></div>
  <el-upload :show-file-list="false" action="action" :on-change="handleChange">
    <el-button type="primary">导入 excel</el-button>
  </el-upload>
</div>
<br/>
<avue-crud :option="option" :data="list"></avue-crud>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.1/xlsx.full.min.js"></script>
<script>
    export default {
        data() {
            return {
                list: [],
                option: {
                    column: [{
                        label: 'id',
                        prop: 'id'
                    }, {
                        label: '姓名',
                        prop: 'name'
                    }, {
                        label: '年龄',
                        prop: 'sex'
                    }]
                }
            }
        },
        methods: {
            handleChange(file, fileLis) {

                this.$export.xlsx(file.raw)
                    .then(data => {
                        this.list = data.results;
                    })
            }
        }
    }
</script>
